]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dnd: Immediately start drag done by pointer devices
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Mon, 31 May 2021 13:12:05 +0000 (10:12 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Mon, 31 May 2021 13:59:11 +0000 (10:59 -0300)
Unlike touch screens, pointer devices (e.g. cursor, touchpad) are
basically never used to switch app grid pages, which is the main
use case for the drag threshold. This point was recently raised
as design feedback.

Immediately start drags when using pointer devices.

See https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3802#note_1124701

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4287

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1866>

js/ui/dnd.js

index 4fbe1acc782bc17511b7467c2131b2209f2c322a..cefde6f603d846ca5a2e56f07d956b06ca264cfb 100644 (file)
@@ -508,9 +508,14 @@ var _Draggable = class _Draggable {
         if (!currentDraggable &&
             (Math.abs(stageX - this._dragStartX) > threshold ||
              Math.abs(stageY - this._dragStartY) > threshold)) {
+            const deviceType = event.get_source_device().get_device_type();
+            const isPointerOrTouchpad =
+                deviceType === Clutter.InputDeviceType.POINTER_DEVICE ||
+                deviceType === Clutter.InputDeviceType.TOUCHPAD_DEVICE;
             const ellapsedTime = event.get_time() - this._dragStartTime;
 
-            if (ellapsedTime > this._dragTimeoutThreshold) {
+            // Pointer devices (e.g. mouse) start the drag immediately
+            if (isPointerOrTouchpad || ellapsedTime > this._dragTimeoutThreshold) {
                 this.startDrag(stageX, stageY, event.get_time(), this._touchSequence, event.get_device());
                 this._updateDragPosition(event);
             } else {